home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / OLE2BOOK.ZIP / CHAP05.ZIP / CHAP05 / PATRON / PATRON.H < prev    next >
C/C++ Source or Header  |  1993-06-07  |  4KB  |  154 lines

  1. /*
  2.  * PATRON.H
  3.  * Modifications for Chapter 5
  4.  *
  5.  * Single include file that pulls in everything needed for other source
  6.  * files in the application.
  7.  *
  8.  * Copyright (c)1993 Microsoft Corporation, All Rights Reserved
  9.  *
  10.  * Kraig Brockschmidt, Software Design Engineer
  11.  * Microsoft Systems Developer Relations
  12.  *
  13.  * Internet  :  kraigb@microsoft.com
  14.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  15.  */
  16.  
  17.  
  18. #ifndef _PATRON_H_
  19. #define _PATRON_H_
  20.  
  21. #include <windows.h>
  22.  
  23. //CHAPTER5MOD
  24. #include <ole2.h>       //Only needed for storage.
  25. #include <ole2ver.h>
  26. #include <bookguid.h>   //Includes debug.h and win1632.h
  27. //End CHAPTER5MOD
  28.  
  29. extern "C"
  30.     {
  31.     #include <commdlg.h>
  32.     #include <print.h>
  33.     }
  34.  
  35. #include <classlib.h>
  36. #include "resource.h"
  37.  
  38. //Get editor window information
  39. #include "pages.h"
  40.  
  41. //PATRON.CPP:  Frame object that creates a main window
  42.  
  43. class __far CPatronFrame : public CFrame
  44.     {
  45.     //CHAPTER5MOD
  46.     private:
  47.         BOOL            m_fInitialized;     //OleInitialize worked
  48.     //End CHAPTER5MOD
  49.  
  50.     protected:
  51.         //Overridable for creating a CPatronClient
  52.         virtual LPCClient CreateCClient(void);
  53.  
  54.         virtual BOOL      FRegisterAllClasses(void);
  55.         virtual UINT      CreateGizmos(void);
  56.         virtual LRESULT   OnCommand(HWND, WPARAM, LPARAM);
  57.  
  58.     public:
  59.         CPatronFrame(HINSTANCE, HINSTANCE, LPSTR, int);
  60.         virtual ~CPatronFrame(void);
  61.  
  62.         //Overrides
  63.         //CHAPTER5MOD
  64.         BOOL FInit(LPFRAMEINIT);
  65.         //End CHAPTER5MOD
  66.  
  67.         virtual void     UpdateMenus(HMENU, UINT);
  68.         virtual void     UpdateGizmos(void);
  69.  
  70.     };
  71.  
  72.  
  73. typedef CPatronFrame FAR * LPCPatronFrame;
  74.  
  75.  
  76.  
  77.  
  78.  
  79. //CLIENT.CPP
  80.  
  81. /*
  82.  * The only reason we have a derived class here is to override
  83.  * CreateCDocument so we can create our own type as well as
  84.  * overriding NewDocument to perform one other piece of work once the
  85.  * document's been created.
  86.  */
  87.  
  88. class __far CPatronClient : public CClient
  89.     {
  90.     protected:
  91.         //Overridable for creating a new CDocument
  92.         virtual LPCDocument CreateCDocument();
  93.  
  94.     public:
  95.         CPatronClient(HINSTANCE);
  96.         virtual ~CPatronClient(void);
  97.     };
  98.  
  99.  
  100. typedef CPatronClient FAR * LPCPatronClient;
  101.  
  102.  
  103.  
  104.  
  105. //DOCUMENT.CPP
  106.  
  107. //Constant ID for the pages window that lives in a document window
  108. #define ID_PAGES            723
  109.  
  110.  
  111. class __far CPatronDoc : public CDocument
  112.     {
  113.     protected:
  114.         LONG            m_lVer;         //Loaded data version
  115.         LPCPages        m_pPG;          //Pages window in us.
  116.  
  117.         //CHAPTER5MOD
  118.         LPSTORAGE       m_pIStorage;    //Root storage for document.
  119.         //End CHAPTER5MOD
  120.  
  121.     protected:
  122.         virtual BOOL    FMessageHook(HWND, UINT, WPARAM, LPARAM, LRESULT FAR *);
  123.  
  124.     public:
  125.         CPatronDoc(HINSTANCE);
  126.         virtual ~CPatronDoc(void);
  127.  
  128.         virtual BOOL     FInit(LPDOCUMENTINIT);
  129.  
  130.         virtual void     Clear(void);
  131.  
  132.         virtual UINT     ULoad(BOOL, LPSTR);
  133.         //CHAPTER5MOD
  134.         virtual UINT     USave(UINT, LPSTR);
  135.         //End CHAPTER5MOD
  136.  
  137.         virtual BOOL     Print(HWND);
  138.         virtual UINT     PrinterSetup(HWND, BOOL);
  139.  
  140.         virtual UINT     NewPage(void);
  141.         virtual UINT     DeletePage(void);
  142.         virtual UINT     NextPage(void);
  143.         virtual UINT     PreviousPage(void);
  144.         virtual UINT     FirstPage(void);
  145.         virtual UINT     LastPage(void);
  146.     };
  147.  
  148. typedef CPatronDoc FAR * LPCPatronDoc;
  149.  
  150.  
  151.  
  152.  
  153. #endif //_PATRON_H_
  154.